#!/usr/bin/perl -nl

our %errs, %warnings, $total, $inerr;

BEGIN {
    use strict;
    use warnings;

    sub get_list {
        my $key = shift;
        $errs{$key} = [] unless $errs{$key};
    }
}

if (/validating (\S+) against registry/) {
    ++$total;
} elsif (/warnings validating (\S+)/) {
    ++$warnings{$1};
} elsif (/error validating (\S+) against endpoint: (.*)/) {
    ++$inerr;
    push @{get_list($2)}, $1;
    delete $warnings{$1};
}

END {
    print "of $total registered services:";
    print "\t", scalar(keys %warnings), " have warnings";
    print "\t$inerr are not responding, of which";
    while (my ($key, $value) = each %errs) {
        my @services = @{get_list($key)};
        print "\t\t", scalar(@services), " report '$key':";
        foreach my $service (sort @services) {
            print "\t\t\t$service";
        }
    }
}
